<script setup lang="ts">
import { ref, reactive } from 'vue'
import TitleBar from '@/components/common/TitleBar.vue'
import StepPage1 from './StepPage1.vue'
import StepPage2 from './StepPage2.vue'
import StepPage3 from './StepPage3.vue'

const active = ref(0)

const next = () => {
  if (active.value++ > 2) active.value = 0
}

const previous = () => {
  if (active.value-- < 1) active.value = 3
}
</script>

<template>
  <div class="container">
    <title-bar>基础设置</title-bar>
    <div class="main">
      <!-- 步骤条 -->
      <el-steps :active="active" finish-status="success" :align-center="true">
        <el-step title="基本设置" />
        <el-step title="功能设置" />
        <el-step title="完成" />
      </el-steps>

      <!-- 步骤内容 -->
      <div>
        <template v-if="active === 0">
          <step-page1 />
        </template>
        <template v-else-if="active === 1">
          <step-page2 />
        </template>
        <template v-else-if="active === 2">
          <step-page3 />
        </template>
      </div>

      <!-- 按钮 -->

      <div class="btn-group">
        <template v-if="active === 0">
          <el-button type="primary" @click="next">下一步</el-button>
        </template>

        <template v-else-if="active === 1">
          <el-button @click="previous">上一步</el-button>
          <el-button type="primary" @click="next">设置</el-button>
        </template>

        <template v-else-if="active === 2">
          <div style="display: flex; justify-content: center">
            <el-button type="primary">添加语料</el-button>
            <el-button type="primary">添加任务</el-button>
          </div>
        </template>
      </div>
    </div>
  </div>
</template>

<style scoped>
.container {
  width: 100%;
  background-color: #fff;
}

.main {
  padding: 20px;
}

.btn-group {
  margin: 20px 0;
}
</style>
